找传奇、传世资源到传世资源站!

C# winform软件 注册、授权例子源码(可做注册机)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

C# winform软件 注册、授权例子源码(可做注册机) C#语言基础-第1张C# winform软件 注册、授权例子源码(可做注册机) C#语言基础-第2张C# winform软件 注册、授权例子源码(可做注册机) C#语言基础-第3张C# winform软件 注册、授权例子源码(可做注册机) C#语言基础-第4张
客户端验证代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Microsoft.Win32;namespace 注册机{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } SoftReg softReg = new SoftReg(); private void Form1_Load(object sender, EventArgs e) { try { //判断软件是否注册 RegistryKey retkey = Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("mySoftWare").CreateSubKey("Register.INI"); foreach (string strRNum in retkey.GetSubKeyNames()) { if (strRNum == softReg.GetRNum()) { this.labRegInfo.Text = "此软件已注册!"; this.btnReg.Enabled = false; return; } } this.labRegInfo.Text = "此软件尚未注册!"; this.btnReg.Enabled = true; MessageBox.Show("您现在使用的是试用版,可以免费试用30次!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); Int32 tLong; //已使用次数 try { tLong = (Int32)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\mySoftWare", "UseTimes", 0); MessageBox.Show("您已经使用了" tLong "次!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("欢迎使用本软件!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\mySoftWare", "UseTimes", 0, RegistryValueKind.DWord); } //判断是否可以继续试用 tLong = (Int32)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\mySoftWare", "UseTimes", 0); if (tLong < 30) { int tTimes = tLong 1; Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\mySoftWare", "UseTimes", tTimes); } else { DialogResult result = MessageBox.Show("试用次数已到!您是否需要注册?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { FormRegister.state = false; //设置软件状态为不可用 btnReg_Click(sender, e); //打开注册窗口 } else { Application.Exit(); } } }catch(Exception ex){ MessageBox.Show("请以管理员身份运行!"); this.Close(); } } private void btnReg_Click(object sender, EventArgs e) { FormRegister frmRegister = new FormRegister(); frmRegister.ShowDialog(); } private void btnClose_Click(object sender, EventArgs e) { Application.Exit(); } }}

注册机部分代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 生成注册码{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } SoftReg softReg = new SoftReg(); private void btnCreate_Click(object sender, EventArgs e) { try { string strHardware = this.txtHardware.Text; string strLicence = softReg.GetRNum(strHardware); this.txtLicence.Text = strLicence; } catch (System.Exception ex) { MessageBox.Show("输入的机器码格式错误!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复